#coding=utf-8
"""
Author:高鑫
Time:2025/8/29 0029 09:14
"""
from config.config import *
import time
import unittest
from public.utiles.HTMLTestRunnerNew import HTMLTestRunner
from public.utiles.mail import SendMail

now = time.strftime("%Y-%m-%d-%H-%M-%S")
filename = report_path + "\\" + str(now) + "_ui_report.html"
def auto_run():
    discover = unittest.defaultTestLoader.discover(start_dir=testcase_path,
                                                   pattern="test_*.py")
    f = open(filename,'wb')
    runner = HTMLTestRunner(stream=f,
                            title="cms后台ui自动化测试报告",
                            description="测试用例执行如下",
                            tester="小高")
    runner.run(discover)
    f.close()
def sendMail():
    sm = SendMail(send_msg=filename,attachment=filename)
    sm.send_mail()
if __name__ == '__main__':
    auto_run()
    sendMail()











